/*
 * 		Test.java
 *   Copyright (C) 2015  Adrián E. Córdoba [software.asia@gmail.com]
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package ar.com.adriancordoba.app.console.atps.manager.state;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import ar.com.adriancordoba.app.console.atps.manager.AppManager;

/**
 *
 * @author Adrián E. Córdoba
 */
public class Recovery implements State {
	private AppManager context;
	private static final Logger logger = LogManager.getLogger(Recovery.class);

	/**
	 * @param context
	 */
	public Recovery(AppManager context) {
		this.context = context;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * ar.com.adriancordoba.app.console.atps.manager.state.State#initialize()
	 */
	public void initialize() {
		logger.error("Cannot initialize AppManager: it has already been initialized.");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ar.com.adriancordoba.app.console.atps.manager.state.State#start()
	 */
	public void start() {
		logger.error("Cannot start AppManager: it has not yet been recovered");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ar.com.adriancordoba.app.console.atps.manager.state.State#process()
	 */
	public void process() {
		logger.error("Cannot process AppManager: it has not yet been started.");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ar.com.adriancordoba.app.console.atps.manager.state.State#stop()
	 */
	public void stop() {
		logger.error("Cannot stop AppManager: it is not yet processing.");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ar.com.adriancordoba.app.console.atps.manager.state.State#recover()
	 */
	public void recover() {
		logger.info("Beginning recovery.");
		// TODO: Recovery code here.
		context.setState(context.getStarting());
		logger.info("Ending recovery.");
	}
}
